/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
#ifndef GAME_MAPRES_COL_H
#define GAME_MAPRES_COL_H

#include <base/vmath.hpp>
#include <game/mapitems.hpp>
enum
{
	COLFLAG_SOLID=1,
	COLFLAG_DEATH=2,
	COLFLAG_NOHOOK=4,
};
enum{
NO_COLL = 0,
QUAD_COLL,
TILE_COLL
};

int col_init();
int col_is_solid(int x, int y);
int col_get(int x, int y);
int col_width();
int col_height();

float AngleBetween(vec2 vect1, vec2 vect2);
int col_intersect_line(vec2 pos0, vec2 pos1, vec2 *out_collision, vec2 *out_before_collision);

bool col_quads_check(const MOVING_QUAD& quad1, vec2 &overlap, bool &isonground);
bool col_quads_point_check(vec2 point);
bool col_quads_line_check(const vec2 &point1, const vec2 &point2, vec2 &pointOfIntersect, vec2 &angleOfReflect);
bool col_quads_line_check(const vec2 &point1, const vec2 &point2, vec2 &pointOfIntersect);
void FindOverlap(const MOVING_QUAD &quad1, QUAD quad2, vec2& overlap);
#endif
